﻿// Page1.cpp: 实现文件
//

#include "pch.h"
#include "wowlua03.h"
#include "Page1.h"
#include "afxdialogex.h"
#include "lua.h"

// Page1 对话框

IMPLEMENT_DYNAMIC(Page1, CDialogEx)

Page1::Page1(CWnd* pParent /*=nullptr*/)
	: CDialogEx(IDD_PAGE1, pParent)
	, p1luastring_(_T("")) {

}

Page1::~Page1()
{
}

void Page1::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
	DDX_Text(pDX, IDC_EDIT1, p1luastring_);
}


BEGIN_MESSAGE_MAP(Page1, CDialogEx)
	ON_BN_CLICKED(IDC_BUTTON1, &Page1::OnBnClickedButton1)
	ON_BN_CLICKED(IDC_BUTTON2, &Page1::OnBnClickedButton2)
END_MESSAGE_MAP()


// Page1 消息处理程序

// dostring
void Page1::OnBnClickedButton1() {
	UpdateData(TRUE);
	std::string luastr = p1luastring_.GetBuffer();
	lua_dostring(atou8(luastr).c_str());
}

// dofile
void Page1::OnBnClickedButton2() {
	auto filepath = "C:\\Inject\\wow\\wow3.3.5\\test\\wow.lua";
	lua_dofile(filepath);
	dbgprint("codergege dofile 完成");
}
